<script type="text/javascript" language="javascript" charset="utf-8">
$(".header-con li a").removeClass("open-menu");
$(".header-con li #configuration").addClass("open-menu");
</script>
<div class="boxed clearfix">
  <div class="common-tit">
    <h2>学员设置</h2>
    <span>公司设置 > 学员设置</span>
  </div>
  <div class="ad-box">
    <div class="account-infor">
      <%= render partial: "company_configuration_nav" %>
      <h3>
        <span>学员分组</span>
      </h3>
      <div class="comp-setbox">
        <div class="comp-set">
          <% @groups.each do |group| %>
            <div class="com-stuw clearfix">
              <ul class="com-stwcon">
                <li>
                  <span>分组名称:</span>
                  <em><%= group.group_name %></em>
                </li>
              </ul>
              <div>
                <%= link_to '删除','javascript:void(0)',
                  onclick: "ajax_function('/admin/company_configurations/destroy_configuration', 'student_group', 'StudentGroupConfiguration', #{group.id})",
                  id: "delete_student_group#{group.id}", class: "comm-del" %>
            </div>
            </div>
          <% end %>
          <%= form_for(@group,:url => create_student_group_admin_company_configurations_path, :html =>{ multipart: true}) do |f| %>
            <div class="com-stua clearfix">
              <ul class="com-stcon">
                <li>
                  <span>分组名称:</span>
                  <%= f.text_field :group_name %>
                </li>
              </ul>
              <%= f.submit "添加", class: "comm-add" %>
            </div>
          <% end %>
        </div>
      </div>
      <h3>
        <span>年龄阶段</span>
      </h3>
      <div class="comp-age clearfix">
        <span>年龄阶段:</span>
        <ul class="clearfix">
          <li>幼儿(3岁-6岁）</li>
          <li>少儿(7岁-12岁）</li>
          <li>少年(13岁-17岁）</li>
          <li>成人(18岁以上)</li>
        </ul>
      </div>
    </div>
    <!-- <div class="com-sbtn">保存</div> -->
  </div>
</div>

<script src="/assets/js/common-list.js"></script>

<script>
//删除学员设置
ajax_function = function (url, type, model_name, value){
var id="#delete_" +type +value
if (confirm("确认删除吗？")){
  $.ajax({
    url: url,
    type:'DELETE',
    data: {
      model_name: model_name,
      value: value,
    },
    success: function(data){
      $(id).parent().parent().remove();
    },
    error:function(){
      alert("出错");
    }
  });
}
}

</script>
